using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._GeostatisticalAnalystTools._Utilities
{
    /// <summary>
    /// <para>Generate Subset Polygons</para>
    /// <para>Generates nonoverlapping subset polygon features from a set of input points. The goal is to divide the points into compact, nonoverlapping subsets, and create polygon regions around each subset of points. The minimum and maximum number of points in each subset can be controlled.</para>
    /// <para>从一组输入点生成非重叠子集面要素。目标是将点划分为紧凑的、不重叠的子集，并在每个点子集周围创建多边形区域。可以控制每个子集中的最小点数和最大点数。</para>
    /// </summary>    
    [DisplayName("Generate Subset Polygons")]
    public class GenerateSubsetPolygons : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public GenerateSubsetPolygons()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_point_features">
        /// <para>Input point features</para>
        /// <para>The points that will be grouped into subsets.</para>
        /// <para>将分组到子集中的点。</para>
        /// </param>
        /// <param name="_out_feature_class">
        /// <para>Output feature class</para>
        /// <para>The polygons defining the region of each subset. All points within a single polygon feature are considered part of the same subset. The polygon feature class will contain a field named PointCount that will store the number of points contained in each polygon subset.</para>
        /// <para>定义每个子集区域的多边形。单个面要素中的所有点都被视为同一子集的一部分。面要素类将包含一个名为 PointCount 的字段，该字段将存储每个面子集中包含的点数。</para>
        /// </param>
        public GenerateSubsetPolygons(object _in_point_features, object _out_feature_class)
        {
            this._in_point_features = _in_point_features;
            this._out_feature_class = _out_feature_class;
        }
        public override string ToolboxName => "Geostatistical Analyst Tools";

        public override string ToolName => "Generate Subset Polygons";

        public override string CallName => "ga.GenerateSubsetPolygons";

        public override List<string> AcceptEnvironments => ["extent", "geographicTransformations", "outputCoordinateSystem", "parallelProcessingFactor", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_point_features, _out_feature_class, _min_points_per_subset, _max_points_per_subset, _coincident_points.GetGPValue()];

        /// <summary>
        /// <para>Input point features</para>
        /// <para>The points that will be grouped into subsets.</para>
        /// <para>将分组到子集中的点。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input point features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_point_features { get; set; }


        /// <summary>
        /// <para>Output feature class</para>
        /// <para>The polygons defining the region of each subset. All points within a single polygon feature are considered part of the same subset. The polygon feature class will contain a field named PointCount that will store the number of points contained in each polygon subset.</para>
        /// <para>定义每个子集区域的多边形。单个面要素中的所有点都被视为同一子集的一部分。面要素类将包含一个名为 PointCount 的字段，该字段将存储每个面子集中包含的点数。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output feature class")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_feature_class { get; set; }


        /// <summary>
        /// <para>Minimum number of points per subset</para>
        /// <para>The minimum number of points that can be grouped into a subset. All subset polygons will contain at least this many points.</para>
        /// <para>可以分组到子集中的最小点数。所有子集面将至少包含这么多点。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Minimum number of points per subset")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _min_points_per_subset { get; set; } = 20;


        /// <summary>
        /// <para>Maximum number of points per subset</para>
        /// <para><xdoc>
        ///   <para>The maximum number of points that can be grouped into a subset.</para>
        ///   <para>Each subset will always contain fewer than two times the Minimum number of points per subset regardless of the maximum number provided. This is because if a subset contains at least twice the minimum number of points, it will always be subdivided into two or more new subsets.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>可分组到子集中的最大点数。</para>
        ///   <para>无论提供的最大点数如何，每个子集的最小点数将始终小于两倍。这是因为如果子集包含至少两倍于最小点数的子集，则该子集将始终细分为两个或多个新子集。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum number of points per subset")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _max_points_per_subset { get; set; } = null;


        /// <summary>
        /// <para>Treat coincident points as a single point</para>
        /// <para><xdoc>
        ///   <para>Specifies whether coincident points (points that are at the same location) are treated like a single point or as multiple individual points.</para>
        ///   <para>If you intend to use the subset polygons as Subset polygon features in EBK Regression Prediction, you should maintain consistency between this parameter and the Coincident points environment in EBK Regression Prediction.</para>
        ///   <para>If this parameter is unchecked, your Output feature class polygons may overlap.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Coincident points will be treated as a single point in the subset. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Coincident points will be treated as multiple individual points in the subset.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是将重合点（位于同一位置的点）视为单个点还是多个单独的点。</para>
        ///   <para>如果打算在 EBK 回归预测中将子集面用作子集面要素，则应保持此参数与 EBK 回归预测中的重合点环境之间的一致性。</para>
        ///   <para>如果未选中此参数，则输出要素类面可能会重叠。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 重合点将被视为子集中的单个点。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中—重合点将被视为子集中的多个单个点。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Treat coincident points as a single point")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _coincident_points_value _coincident_points { get; set; } = _coincident_points_value._true;

        public enum _coincident_points_value
        {
            /// <summary>
            /// <para>COINCIDENT_SINGLE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("COINCIDENT_SINGLE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>COINCIDENT_ALL</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("COINCIDENT_ALL")]
            [GPEnumValue("false")]
            _false,

        }

        public GenerateSubsetPolygons SetEnv(object extent = null, object geographicTransformations = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(extent: extent, geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}